<?php
	require_once 'models/models_hang.php';
	$mod = $_GET['mod'];
	$obh = new models_hang();
	switch ($mod){
		case 'hang':{
			$data['list'] = $obh->_listhang();
			require 'views/admin/hang/index.php';
			break;
		}
		case 'addhang':{
			if($_POST){
				$obh->_addhang($_POST['tenh']);
				echo '<script> window.location.href="admin.php?mod=hang"</script>';
			}
			require 'views/admin/hang/add.php';
			break;
		}
		case 'delhang':{
			$obh->_delHang($_GET['ma']);
			echo '<script> window.location.href="admin.php?mod=hang"</script>';
			break;
		}
		case 'updatehang':{
			if($_POST){
				$obh->_updateHang($_POST['tenh'], $_GET['ma']);
				echo '<script> window.location.href="admin.php?mod=hang"</script>';
			}
			$data = $obh->_getHang($_GET['ma']);
			require 'views/admin/hang/edit.php';
			break;
		}
		default: echo 'Yeu cau khong duoc xu ly'; break;
	}
?>